home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / gtksourceview-2.0 / language-specs / php.lang < prev    next >
Encoding:
Extensible Markup Language  |  2009-10-02  |  10.6 KB  |  330 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: Francesco Gigli <jaramir@aruba.it>
  5.  Copyright (C) 2003 Francesco Gigli <jaramir@aruba.it>
  6.  Copyright (C) 2004 David A Knight <david@ritter.demon.co.uk>
  7.  Copyright (C) 2005 Rowan Lewis <rowanjl@gmail.com>
  8.  Copyright (C) 2006 Steve Fr├⌐cinaux <steve@istique.net>
  9.  Copyright (C) 2007 Patryk Zawadzki <patrys@pld-linux.org>
  10.  Copyright (C) 2007 Eric Norige <thelema@swbell.net>
  11.  
  12.  This library is free software; you can redistribute it and/or modify
  13.  it under the terms of the GNU General Public License as published by
  14.  the Free Software Foundation; either version 2 of the License, or
  15.  (at your option) any later version.
  16.  
  17.  This program is distributed in the hope that it will be useful,
  18.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.  GNU General Public License for more details.
  21.  
  22.  You should have received a copy of the GNU General Public License
  23.  along with this program; if not, write to the Free Software
  24.  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25.  
  26. -->
  27. <language id="php" _name="PHP" version="2.0" _section="Scripts">
  28.   <metadata>
  29.     <property name="mimetypes">text/x-php;application/x-php;text/x-php-source;application/x-php-source</property>
  30.     <property name="globs">*.php;*.php3;*.php4;*.phtml</property>
  31.     <property name="line-comment-start">#</property>
  32.     <property name="block-comment-start">/*</property>
  33.     <property name="block-comment-end">*/</property>
  34.   </metadata>
  35.  
  36.   <styles>
  37.     <style id="comment" _name="Comment" map-to="def:comment"/>
  38.     <style id="error" _name="Error" map-to="def:error"/>
  39.     <style id="variable" _name="Variable" map-to="def:identifier"/>
  40.     <style id="identifier" _name="Identifier"/> <!-- map to nothing -->
  41.     <style id="escape" _name="Escaped Character" map-to="def:special-char"/>
  42.     <style id="string" _name="String" map-to="def:string"/>
  43.     <style id="here-doc" _name="Heredoc" map-to="def:string"/>
  44.     <style id="here-doc-bound" _name="Heredoc Bound" map-to="def:keyword"/>
  45.     <style id="keyword" _name="Keyword" map-to="def:keyword"/>
  46.     <style id="operator" _name="Operator" map-to="def:operator"/>
  47.     <style id="type" _name="Data Type" map-to="def:type"/>
  48.     <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
  49.     <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
  50.     <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
  51.     <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
  52.     <style id="octal" _name="Octal number" map-to="def:base-n-integer"/>
  53.     <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
  54.   </styles>
  55.  
  56.   <definitions>
  57.  
  58.     <context id="bash-line-comment" style-ref="comment" end-at-line-end="true" extend-parent="false">
  59.       <start>#</start>
  60.       <include>
  61.         <context ref="def:in-line-comment"/>
  62.       </include>
  63.     </context>
  64.  
  65.     <context id="cpp-line-comment" style-ref="comment" end-at-line-end="true" extend-parent="false">
  66.       <start>//</start>
  67.       <include>
  68.         <context ref="def:in-line-comment"/>
  69.       </include>
  70.     </context>
  71.  
  72.     <context id="c-block-comment" style-ref="comment">
  73.       <start>/\*</start>
  74.       <end>\*/</end>
  75.       <include>
  76.         <context ref="def:in-line-comment"/>
  77.       </include>
  78.     </context>
  79.  
  80.     <context id="close-comment-outside-comment" style-ref="error">
  81.       <match>\*/(?!\*)</match>
  82.     </context>
  83.  
  84.     <context id="escape" style-ref="escape">
  85.       <match>\\((\\|"|n|t|\$|r)|[0-7]{1,3}|x[0-9a-fA-F]{1,2})</match>
  86.     </context>
  87.  
  88.     <context id="variable" style-ref="variable">
  89.       <match>[$]+[a-zA-Z_][a-zA-Z0-9_]*</match>
  90.     </context>
  91.  
  92.     <context id="array-operators" style-ref="variable">
  93.       <match>(\[|\])</match>
  94.     </context>
  95.  
  96.     <context id="string-var">
  97.       <include>
  98.         <context ref="variable"/>
  99.         <context id="curly-var" style-ref="variable" >
  100.           <start>{(?=\$)</start>
  101.           <end>}</end>
  102.           <include>
  103.             <context ref="string-var"/>
  104.           </include>
  105.         </context>
  106.         <context id="backwards-curly-var" style-ref="variable">
  107.           <start>\${</start>
  108.           <end>}</end>
  109.           <include>
  110.             <context ref="string-var"/>
  111.           </include>
  112.         </context>
  113.       </include>
  114.     </context>
  115.  
  116.     <context id="double-quoted-string" style-ref="string">
  117.       <start>"</start>
  118.       <end>"</end>
  119.       <include>
  120.         <context ref="escape"/>
  121.         <context ref="string-var"/>
  122.         <context ref="def:line-continue"/>
  123.       </include>
  124.     </context>
  125.  
  126.     <context id="single-quoted-string" style-ref="string">
  127.       <start>'</start>
  128.       <end>'</end>
  129.       <include>
  130.         <context style-ref="def:special-char">
  131.           <match>\\['\\]</match>
  132.         </context>
  133.         <context ref="def:line-continue"/>
  134.       </include>
  135.     </context>
  136.  
  137.     <context id="backtick-string" style-ref="string" extend-parent="false">
  138.       <start>`</start>
  139.       <end>`</end>
  140.       <include>
  141.         <context ref="escape"/>
  142.         <context ref="def:line-continue"/>
  143.       </include>
  144.     </context>
  145.  
  146.     <context id="here-doc-string" style-ref="here-doc" extend-parent="true">
  147.       <start>(<<<)\s?([a-zA-Z_][a-zA-Z0-9_]*)</start>
  148.       <end>^(\%{2@start});?$</end>
  149.       <include>
  150.         <context sub-pattern="0" where="start" style-ref="here-doc-bound"/>
  151.         <context sub-pattern="1" where="end" style-ref="here-doc-bound"/>
  152.         <context ref="escape"/>
  153.         <context ref="string-var"/>
  154.         <context ref="def:line-continue"/>
  155.       </include>
  156.     </context>
  157.  
  158.     <context id="identifier" style-ref="identifier">
  159.       <match>[a-zA-Z_][a-zA-Z0-9_]*</match>
  160.     </context>
  161.  
  162.     <context id="keywords" style-ref="keyword">
  163.       <keyword>abstract</keyword>
  164.       <keyword>and</keyword>
  165.       <keyword>as</keyword>
  166.       <keyword>break</keyword>
  167.       <keyword>case</keyword>
  168.       <keyword>catch</keyword>
  169.       <keyword>class</keyword>
  170.       <keyword>const</keyword>
  171.       <keyword>continue</keyword>
  172.       <keyword>default</keyword>
  173.       <keyword>die</keyword>
  174.       <keyword>do</keyword>
  175.       <keyword>doubleval</keyword>
  176.       <keyword>echo</keyword>
  177.       <keyword>else</keyword>
  178.       <keyword>elseif</keyword>
  179.       <keyword>empty</keyword>
  180.       <keyword>endfor</keyword>
  181.       <keyword>endforeach</keyword>
  182.       <keyword>endif</keyword>
  183.       <keyword>endswitch</keyword>
  184.       <keyword>endwhile</keyword>
  185.       <keyword>extends</keyword>
  186.       <keyword>final</keyword>
  187.       <keyword>floatval</keyword>
  188.       <keyword>for</keyword>
  189.       <keyword>foreach</keyword>
  190.       <keyword>function</keyword>
  191.       <keyword>gettype</keyword>
  192.       <keyword>global</keyword>
  193.       <keyword>if</keyword>
  194.       <keyword>implements</keyword>
  195.       <keyword>import</keyword>
  196.       <keyword>include</keyword>
  197.       <keyword>include_once</keyword>
  198.       <keyword>instanceof</keyword>
  199.       <keyword>interface</keyword>
  200.       <keyword>intval</keyword>
  201.       <keyword>list</keyword>
  202.       <keyword>namespace</keyword>
  203.       <keyword>new</keyword>
  204.       <keyword>or</keyword>
  205.       <keyword>print</keyword>
  206.       <keyword>print_r</keyword>
  207.       <keyword>private</keyword>
  208.       <keyword>protected</keyword>
  209.       <keyword>public</keyword>
  210.       <keyword>require</keyword>
  211.       <keyword>require_once</keyword>
  212.       <keyword>return</keyword>
  213.       <keyword>serialize</keyword>
  214.       <keyword>settype</keyword>
  215.       <keyword>static</keyword>
  216.       <keyword>strval</keyword>
  217.       <keyword>switch</keyword>
  218.       <keyword>throw</keyword>
  219.       <keyword>try</keyword>
  220.       <keyword>unserialize</keyword>
  221.       <keyword>unset</keyword>
  222.       <keyword>var</keyword>
  223.       <keyword>var_dump</keyword>
  224.       <keyword>var_export</keyword>
  225.       <keyword>while</keyword>
  226.       <keyword>xor</keyword>
  227.     </context>
  228.  
  229.     <context id="operators" style-ref="operator" extend-parent="false">
  230.       <match>[-.~^@,;:/%|\=\+\*\!\?&<>()]</match>
  231.     </context>
  232.  
  233.     <context id="type" style-ref="type">
  234.       <keyword>array</keyword>
  235.       <keyword>bool</keyword>
  236.       <keyword>boolean</keyword>
  237.       <keyword>double</keyword>
  238.       <keyword>float</keyword>
  239.       <keyword>int</keyword>
  240.       <keyword>integer</keyword>
  241.       <keyword>object</keyword>
  242.       <keyword>real</keyword>
  243.       <keyword>string</keyword>
  244.       <keyword>unset</keyword>
  245.     </context>
  246.  
  247.     <context id="null-value" style-ref="null-value">
  248.       <prefix>(?i)\b</prefix> <!-- case insensitive -->
  249.       <keyword>null</keyword>
  250.     </context>
  251.  
  252.     <context id="boolean" style-ref="boolean">
  253.       <prefix>(?i)\b</prefix> <!-- case insensitive -->
  254.       <keyword>false</keyword>
  255.       <keyword>true</keyword>
  256.     </context>
  257.  
  258.     <context id="float" style-ref="floating-point">
  259.       <match extended="true">
  260.         (?<![\w\.])
  261.         ([0-9]+[Ee][+-]?[0-9]+ |
  262.          ([0-9]*\.[0-9]+ | [0-9]+\.[0-9]*)([Ee][+-]?[0-9]+)?)
  263.         (?![\w\.])
  264.       </match>
  265.     </context>
  266.  
  267.     <context id="decimal-number" style-ref="decimal">
  268.       <match extended="true">
  269.         (?<![\w\.])
  270.         [+-]?([1-9][0-9]*|0)
  271.         (?![\w\.])
  272.       </match>
  273.     </context>
  274.  
  275.     <context id="octal-number" style-ref="octal">
  276.       <match extended="true">
  277.         (?<![\w\.])
  278.         [+-]?0[0-7]+
  279.         (?![\w\.])
  280.       </match>
  281.     </context>
  282.  
  283.     <context id="hexadecimal-number" style-ref="hexadecimal">
  284.       <match extended="true">
  285.         (?<![\w\.])
  286.         [+-]?0x[0-9a-fA-F]+
  287.         (?![\w\.])
  288.       </match>
  289.     </context>
  290.  
  291.     <context id="php-block">
  292.       <start><([?](php)?)</start>
  293.       <end>[?]></end>
  294.       <include>
  295.         <context sub-pattern="0" where="start" style-ref="keyword"/>
  296.         <context sub-pattern="0" where="end" style-ref="keyword"/>
  297.         <context ref="cpp-line-comment"/>
  298.         <context ref="bash-line-comment"/>
  299.         <context ref="c-block-comment"/>
  300.         <context ref="double-quoted-string"/>
  301.         <context ref="single-quoted-string"/>
  302.         <context ref="backtick-string"/>
  303.         <context ref="here-doc-string"/>
  304.         <context ref="variable"/>
  305.         <context ref="array-operators"/>
  306.         <context ref="keywords"/>
  307.         <context ref="operators"/>
  308.         <context ref="type"/>
  309.         <context ref="null-value"/>
  310.         <context ref="boolean"/>
  311.         <context ref="float"/>
  312.         <context ref="decimal-number"/>
  313.         <context ref="octal-number"/>
  314.         <context ref="hexadecimal-number"/>
  315.     <context ref="identifier"/>
  316.       </include>
  317.     </context>
  318.  
  319.     <replace id="html:embedded-lang-hook" ref="php-block"/>
  320.  
  321.     <context id="php">
  322.       <include>
  323.         <context ref="php-block"/>
  324.         <context ref="html:html"/>
  325.       </include>
  326.     </context>
  327.  
  328.   </definitions>
  329. </language>
  330.